package com.yunhe.sms.service.activity.impl;

import com.yunhe.commons.dto.Pageable;
import com.yunhe.commons.util.StringUtils;
import com.yunhe.sms.dao.activity.VoteDao;
import com.yunhe.sms.dao.activity.impl.VoteDaoImpl;
import com.yunhe.sms.entity.activity.Vote;
import com.yunhe.sms.service.activity.VoteService;

/**
 * Created by Administrator on 2017/10/30 0030.
 */
public class VoteServiceImpl implements VoteService {

    private VoteDao voteDao = new VoteDaoImpl();
    @Override
    public Long save(Vote vote) {
        return voteDao.save(vote);
    }

    @Override
    public void update(Vote vote) {
        voteDao.update(vote);
    }

    @Override
    public void delete(Long id) {
        voteDao.delete(id);
    }

    @Override
    public void deleteBatch(String ids) {
        if(StringUtils.notEmpty(ids)){
            String[] idArr = ids.split(",");
            for(String i:idArr){
                this.delete(new Long(i));
            }
        }
    }

    @Override
    public Vote find(Long id) {
       return voteDao.find(id);
    }

    @Override
    public Pageable<Vote> findPage(Integer offset, Integer limit) {
        return voteDao.findPage(offset,limit);
    }
}
